How to group data together in SQL

join shbcf.ru